gtkstacksidebar.h \
gtksizegroup.h \
gtksizerequest.h \
+ gtksnapshot.h \
gtkspinbutton.h \
gtkspinner.h \
gtkstack.h \
gtksidebarrowprivate.h \
gtksizegroup-private.h \
gtksizerequestcacheprivate.h \
+ gtksnapshotprivate.h \
gtkstyleanimationprivate.h \
gtkstylecascadeprivate.h \
gtkstylecontextprivate.h \
gtksizerequest.c \
gtksizerequestcache.c \
gtkshow.c \
- gtkstacksidebar.c \
+ gtksnapshot.c \
gtkspinbutton.c \
gtkspinner.c \
gtkstack.c \
+ gtkstacksidebar.c \
gtkstackswitcher.c \
gtkstatusbar.c \
gtkstyleanimation.c \
#include <gtk/gtkshortcutsshortcut.h>
#include <gtk/gtkshortcutswindow.h>
#include <gtk/gtkshow.h>
+#include <gtk/gtksnapshot.h>
#include <gtk/gtkstacksidebar.h>
#include <gtk/gtksizegroup.h>
#include <gtk/gtksizerequest.h>
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2016 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gtksnapshot.h"
+#include "gtksnapshotprivate.h"
+
+void
+gtk_snapshot_init (GtkSnapshot *state,
+ const GtkSnapshot *parent,
+ const graphene_matrix_t *transform)
+{
+ state->parent = parent;
+ state->renderer = parent->renderer;
+
+ graphene_matrix_init_from_matrix (&state->transform, transform);
+}
+
+void
+gtk_snapshot_init_root (GtkSnapshot *state,
+ GskRenderer *renderer)
+{
+ state->parent = NULL;
+ state->renderer = renderer;
+
+ graphene_matrix_init_identity (&state->transform);
+}
+
+void
+gtk_snapshot_finish (GtkSnapshot *state)
+{
+ /* nothing to do so far */
+}
+
+GskRenderer *
+gtk_snapshot_get_renderer (const GtkSnapshot *state)
+{
+ return state->renderer;
+}
+
+GskRenderNode *
+gtk_snapshot_create_render_node (const GtkSnapshot *state,
+ const char *name,
+ ...)
+{
+ GskRenderNode *node;
+
+ node = gsk_renderer_create_render_node (state->renderer);
+
+ if (name)
+ {
+ va_list args;
+ char *str;
+
+ va_start (args, name);
+ str = g_strdup_vprintf (name, args);
+ va_end (args);
+
+ gsk_render_node_set_name (node, str);
+
+ g_free (str);
+ }
+
+ return node;
+}
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2016 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_SNAPSHOT_H__
+#define __GTK_SNAPSHOT_H__
+
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gsk/gsk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GtkSnapshot GtkSnapshot;
+
+
+GDK_AVAILABLE_IN_3_90
+GskRenderer * gtk_snapshot_get_renderer (const GtkSnapshot *state);
+
+GDK_AVAILABLE_IN_3_90
+GskRenderNode * gtk_snapshot_create_render_node (const GtkSnapshot *state,
+ const char *name,
+ ...) G_GNUC_PRINTF(2, 3);
+
+G_END_DECLS
+
+#endif /* __GTK_SNAPSHOT_H__ */
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2016 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_SNAPSHOT_PRIVATE_H__
+#define __GTK_SNAPSHOT_PRIVATE_H__
+
+#include "gtksnapshot.h"
+
+G_BEGIN_DECLS
+
+struct _GtkSnapshot {
+ const GtkSnapshot *parent;
+
+ GskRenderer *renderer;
+
+ graphene_matrix_t transform;
+};
+
+void gtk_snapshot_init (GtkSnapshot *state,
+ const GtkSnapshot *parent,
+ const graphene_matrix_t *transform);
+void gtk_snapshot_init_root (GtkSnapshot *state,
+ GskRenderer *renderer);
+
+void gtk_snapshot_finish (GtkSnapshot *state);
+
+G_END_DECLS
+
+#endif /* __GTK_SNAPSHOT_PRIVATE_H__ */
#include "gtkapplicationprivate.h"
#include "gtkgestureprivate.h"
#include "gtkwidgetpathprivate.h"
+#include "gtksnapshotprivate.h"
#include "inspector/window.h"
GskRenderNode *
gtk_widget_get_render_node (GtkWidget *widget,
GskRenderer *renderer)
+{
+ GtkSnapshot snapshot;
+ GskRenderNode *node;
+
+ gtk_snapshot_init_root (&snapshot, renderer);
+
+ node = gtk_widget_snapshot (widget, &snapshot);
+
+ gtk_snapshot_finish (&snapshot);
+
+ return node;
+}
+
+GskRenderNode *
+gtk_widget_snapshot (GtkWidget *widget,
+ const GtkSnapshot *snapshot)
{
GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
GskRenderNode *node;
{
GskRenderNode *tmp;
cairo_t *cr;
- char *str;
-
- str = g_strconcat ("Fallback<", G_OBJECT_TYPE_NAME (widget), ">", NULL);
- tmp = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (tmp, str);
+ tmp = gtk_snapshot_create_render_node (snapshot, "Fallback<%s>", G_OBJECT_TYPE_NAME (widget));
gsk_render_node_set_bounds (tmp, &bounds);
gsk_render_node_set_transform (tmp, &m);
- cr = gsk_render_node_get_draw_context (tmp, renderer);
+ cr = gsk_render_node_get_draw_context (tmp, gtk_snapshot_get_renderer (snapshot));
cairo_translate (cr, alloc.x - clip.x, alloc.y - clip.y);
gtk_widget_draw_internal (widget, cr, TRUE);
cairo_destroy (cr);
- g_free (str);
-
node = tmp;
}
else
{
- node = klass->get_render_node (widget, renderer);
+ node = klass->get_render_node (widget, gtk_snapshot_get_renderer (snapshot));
/* Compatibility mode: if there's a ::draw signal handler, we add a
* child node with the contents of the handler
GskRenderNode *tmp;
gboolean result;
cairo_t *cr;
- char *str;
-
- str = g_strconcat ("DrawSignal<", G_OBJECT_TYPE_NAME (widget), ">", NULL);
- tmp = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (tmp, str);
+ tmp = gtk_snapshot_create_render_node (snapshot, "DrawSignal<%s>", G_OBJECT_TYPE_NAME (widget));
gsk_render_node_set_bounds (tmp, &bounds);
- cr = gsk_render_node_get_draw_context (tmp, renderer);
+ cr = gsk_render_node_get_draw_context (tmp, gtk_snapshot_get_renderer (snapshot));
cairo_translate (cr, alloc.x - clip.x, alloc.y - clip.y);
g_signal_emit (widget, widget_signals[DRAW], 0, cr, &result);
cairo_destroy (cr);
- g_free (str);
-
if (node != NULL)
{
gsk_render_node_append_child (node, tmp);
const cairo_region_t *region)
{
GdkDrawingContext *context;
+ GtkSnapshot snapshot;
GskRenderer *renderer;
GskRenderNode *root;
if (renderer == NULL)
return;
- root = gtk_widget_get_render_node (widget, renderer);
+ gtk_snapshot_init_root (&snapshot, renderer);
+ root = gtk_widget_snapshot (widget, &snapshot);
+ gtk_snapshot_finish (&snapshot);
if (root == NULL)
return;
#include "gtkeventcontroller.h"
#include "gtkactionmuxer.h"
#include "gtksizerequestcacheprivate.h"
+#include "gtksnapshot.h"
G_BEGIN_DECLS
GskRenderNode * gtk_widget_get_render_node (GtkWidget *widget,
GskRenderer *renderer);
+GskRenderNode * gtk_widget_snapshot (GtkWidget *widget,
+ const GtkSnapshot *snapshot);
GskRenderNode * gtk_widget_create_render_node (GtkWidget *widget,
GskRenderer *renderer,